import { defineStore } from 'pinia';
import { reactive } from 'vue';

export default defineStore('VideoMatch', () => {
    const videoCallAttr = reactive({
        message: 'startMatch',  // startMatch表示匹配界面，endMatch表示释放匹配到的志愿者
        peerId: '',
        types: '',
        socket: null,
        volPeerId: '',
    })
    const updateSocket = (socket) => {
        videoCallAttr.socket = socket
    }

    const updateTypes = (types) => {
        videoCallAttr.types = types
    }

    const updateMessage = (message) => {
        videoCallAttr.message = message
    }

    const updateVolPeerId = (peerId) => {
        videoCallAttr.volPeerId = peerId

    }
    return {
        videoCallAttr,
        updateSocket,
        updateTypes,
        updateMessage,
        updateVolPeerId
    }
})